package net.esj.tree.utils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import net.esj.basic.core.view.support.vojo.BaseVojo;

public class TreeEntity implements BaseVojo{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 3466482951636714105L;
	
	private Serializable id;
	
	private String text;
	
	private Boolean hasChild = true;
	
	private String icon;
	
	private Boolean checked = false;
	
	private int state = 1;
	
	private List<TreeEntity> children = new ArrayList<TreeEntity>();
	

	public TreeEntity() {
		super();
	}
	
	public TreeEntity(Serializable id, String text) {
		super();
		this.id = id;
		this.text = text;
	}



	@Override
	public Serializable getId() {
		return id;
	}

	@Override
	public void setId(Serializable id) {
		this.id = id;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public Boolean getHasChild() {
		return hasChild;
	}

	public void setHasChild(Boolean hasChild) {
		this.hasChild = hasChild;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public Boolean getChecked() {
		return checked;
	}

	public void setChecked(Boolean checked) {
		this.checked = checked;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public List<TreeEntity> getChildren() {
		return children;
	}

	public void setChildren(List<TreeEntity> children) {
		this.children = children;
	}

	public void addChild(TreeEntity child){
		this.children.add(child);
	}
	
	public void addChildren(Collection<TreeEntity> children){
		this.children.addAll(children);
	}
}
